package class202205.demo05.demo03;

/**
 * 抽象类
 */

abstract class Shape{
   /* public String name;
    public int age;
    public void func(){
        System.out.println("ada");
    }
    public static void func2(){
        System.out.println("akjdhkjasd");
    }*/
    public abstract void draw();//抽象方法
}
abstract class A extends Shape{  //当一个抽象类A继承抽象类Shape时，可以不重写抽象类Shape中的方法
    public abstract void func();
}
class B extends A{  //出来混迟早得还，父类没有重写  你全写

    @Override
    public void draw() {

    }

    @Override
    public void func() {

    }
}
class Circle extends Shape {  //普通类继承了抽象类（内有抽象方法），这里报错，  必须重写Shap类当中的抽象个方法

    @Override
    public void draw() {
        System.out.println("⚪");
    }
}
class Rect extends Shape {
    @Override
    public void draw() {
        System.out.println("♦");
    }
}
class Triangle extends Shape {
    @Override
    public void draw() {
        System.out.println("🔺");
    }
}
public class Testdemo {

    public static void drawMap(Shape shape){
        shape.draw();
    }

    public static void main(String[] args) {
        //Shape shape = new Shape();    //1、抽象类不能进行实例化
        Circle circle = new Circle();
        Rect rect = new Rect();
        Triangle triangle = new Triangle();
        drawMap(circle);
        drawMap(rect);
        drawMap(triangle);
    }
}
